import { SysOrder } from "../../GameDef";
import { ECSEntity } from "../../lib/kgame/ecs/ECSEntity";
import { IECSFilter } from "../../lib/kgame/ecs/ECSFilter";
import { ECSSys } from "../../lib/kgame/ecs/ECSSys";
import { CmpAI } from "../cmp/CmpAI";

export class SysAI extends ECSSys {

    get updateOrder(): number {
        return SysOrder.ai;
    }

    get ifilter(): IECSFilter {
        return { includeOne: [CmpAI] };
    }

    protected onUpdateEntity(entity: ECSEntity): void {
        const ai = entity.getCmp(CmpAI);
        ai.ai.update(this.scene.dt);
    }

}